#include <factory_pattern.h>
#include <iostream>

using namespace std;

void Rectangle::draw() {
    cout << "Inside Rectangle::draw() method." << endl;
}

void Square::draw() {
    cout << "Inside Square::draw() method." << endl;
}

void Circle::draw() {
    cout << "Inside Circle::draw() method." << endl;
}

Shape * ShapeFactory::getShape(QString shapeType) {
    if(shapeType.isEmpty())
    {
        return nullptr;
    }
    if(shapeType.toUpper() == "CIRCLE") {
        return new Circle();
    } else if(shapeType.toUpper() == "RECTANGLE") {
        return new Rectangle();
    } else if(shapeType.toUpper() == "SQUARE") {
        return new Square();
    }
    return nullptr;
}
/*
    ShapeFactory *shapeFactory = new ShapeFactory();
    Shape *shape1 = shapeFactory->getShape("CIRCLE");
    shape1->draw();
    Shape *shape2 = shapeFactory->getShape("RECTANGLE");
    shape2->draw();
    Shape *shape3 = shapeFactory->getShape("SQUARE");
    shape3->draw();
*/
